
export let baseUrl = "http://8.217.156.237:12001"
let model = ""


export function request(params) {
 let token = uni.getStorageSync('token')
	
	let {
		url,
		data,
		method,
		
	} = params
	
	return new Promise((reslove, reject) => {
		uni.request({
			url: baseUrl + url, //仅为示例，并非真实接口地q址。
			data,
			method,
			header: {
				"token": token ? token : '',
				'Content-Type':'application/x-www-form-urlencoded'
			},
			success: (res) => {
				console.log(res)
				if(res.data.code === 200){
					reslove(res.data)
				}else{
					uni.showToast({
						title:res.data.msg,
						icon:"none"
					})
					// reject(false)
				}
				
			},
			fail: (ret) => {
				reject(ret)
			},
			complete: function() {
				uni.hideLoading();
			}
		});
	})
}

